﻿namespace USElections.Model.JSON
{
    using System.Runtime.Serialization;

    /// <summary>
    /// Votes class.
    /// </summary>
    [DataContract(Name = "votes")]
    public class Votes
    {
        #region Fields
        private int candidateId;
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the Candidate Id.
        /// </summary>
        [DataMember(Name = "cid")]
        public int CandidateId
        {
            get
            {
                return this.candidateId;
            }

            set
            {
                this.candidateId = value;
                this.Candidate = Data.Instance.Candidates.GetCandidateById(this.CandidateId);
            }
        }

        public Candidate Candidate
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets the number of votes.
        /// </summary>
        [DataMember(Name = "votes")]
        public int NumberOfVotes { get; set; }
        #endregion
    }
}
